package common

import (
	"fmt"
	"os"
)

func ReadFileData(path string) ([]byte, int) {
	configFilePtr, configFileErr := os.Open(path)
	if nil != configFileErr {
		fmt.Printf("open file error,path=[%s],err=s:[%s]", path, configFileErr.Error())
		return nil, 0
	}

	defer configFilePtr.Close()

	data := make([]byte, 10240)
	dataLength, dataErr := configFilePtr.Read(data)
	if nil != dataErr {
		fmt.Printf("read file error,path=[%s],err=s:[%s]", path, configFileErr.Error())
		return nil, 0
	}
	return data, dataLength
}
